#include<iostream>
#include<cstdio>
#include<sys/wait.h>
#include<unistd.h>
#include<cstdlib>
using namespace std;


int main(){
  pid_t pid = fork();
  if(pid == 0){
  //child process
    int time = 15;
    while(time--){
    cout<<"this is child process"<<getpid()<<",its running"<<time<<endl;
      sleep(1);
    }
    exit(1);
  }
  int status = 0;
  pid_t id = wait(&status);
  printf("wait success:exit sig:%d,exit code:%d",status&0x7F,(status>>8)&0xFF);
  return 0;
}
